How to install python package with a different nam

2019-02-11 14:54发布

When installing a new python package with PIP, can I change the package name because there is another package with the same name?

Or, how can I change the existing package's name?

8条回答
相关推荐>>
2楼-- · 2019-02-11 15:23

Create a new virtualenv and then install the package on new virtualenv, with this you can have the different version of packages as well.

查看更多
太酷不给撩
3楼-- · 2019-02-11 15:25

I Don't think it is possible to change the name of package by using pip. Because pip can install packages which are exist and gives error if there is no package name which you write for change the name of package.

查看更多
ゆ 、 Hurt°
4楼-- · 2019-02-11 15:27

I had this problem with the libraries gmail and pygmail, they both want to install to site-packages/gmail/. Clearly the pygmail package has an issue, it should be installing to pygmail folder, but they haven't made any updates in years.

For an interim solution, I installed one, then changed the folder names, then installed the second one. Seems to work, as long as I don't try to update the first package.

查看更多
孤傲高冷的网名
5楼-- · 2019-02-11 15:32

I guess it depends if you need to update either of them. If you don't, then you can go to your site-packages folder, and rename the folder

查看更多
放我归山
6楼-- · 2019-02-11 15:36

This is not possible with the pip command line tool. All of the packages on PyPI have unique names. Packages often require and depend on each other, and assume the name will not change.

查看更多
小情绪 Triste *
7楼-- · 2019-02-11 15:43

I think one way of going about this can be using

pip download

See the docs here. You can change the name of the package after it has been downloaded and then go about manually installing it. I haven't tested this but seems like it should work.

查看更多
登录 后发表回答