问题
I have python 2.7 installed perfectly, and also pip, and I have been running the PowerShell as admin.
I did:
pip install virtualenv
and
pip install virtualenvwrapper-powershell
and they both were succesfull.
I also did this:
mkdir '~.virtualenvs'
However, whenever I try to:
Import-Module virtualenvwrapper
it always gets me this error: Import-Module: The specific module 'virtualenvwrapper' was not loaded because no valid module file was found in any module directory.
I did pip install virtualenvwrapper-powershell again just to make sure, and I got this: Requirement already satisfied (use --upgrade to upgrade): virtualenvwrapper-powershell in c:\python27\lib\site-packages
What could be wrong ?
回答1:
I met the same problem when I tried to do the exact same thing as what you did. Finally I figured it out. I found that the virtualenvwrapper I installed is somehow not in the current folder (C:). Instead, it is hidden in the folder:
C:\Python27\Lib\site-packages\Users\*myusername*\Documents\WindowsPowerShell\Modules\VirtualEnvWrapper
I recommend you go to your Python folder and try to search something like
"\Lib\site-packages\Users\*myusername*\Documents\WindowsPowerShell\Modules\"
and if you can find the module VirtualEnvWrapper there, then when you type the command, you just need to include the complete path.
I hope it will help.
回答2:
You must be following the setup instructions for http://newcoder.io/begin/setup-your-machine/#windows. Me too. Here is how I fixed it:
- From Powershell, type "Get-ChildItem Env:PSModulePath" The value of this variable tells you the folder that Powershell looks when importing modules.
- pip installed my module to "C:\Python27\Lib\site-packages\Users\\Documents\WindowsPowerShell\Modules\virtualenvwrapper"
- Copy that folder to the folder from step #1
- Restart Powershell
回答3:
This helped me out so much
After going to pc -> C: -> Python27 -> Lib -> site-packages -> users -> * your user * -> WindowsPowerShell -> Modules -> Copy the VirtualEnvWrapper
In a self made directory in Documents call it WindowsPowerShell and then make another inside it called Modules Copy the VirtualEnvWrapper folder within this.
then drop a set-executionpolicy unrestricted in CMD as ADMINISTRATOR !!!
followed by a Import-Module virtualenvwrapper
and you should be 100%
https://stackoverflow.com/a/31040546/5185974
回答4:
I had the same issue today on a fresh win 10 system. For some reason the VirtualEnvWrapper seems to create a User folder in the site-packages folder inside your Python installation, where it can't be found. Just moving the "Modules" with all its content did the trick.
-> (in my case from:)
C:\Program Files (x86)\Python27\Lib\site-packages\Users\*USER*\Documents\WindowsPowerShell\**Modules**\VirtualEnvWrapper
-> to C:\Users\*USER*\Documents\WindowsPowerShell\**Modules**\VirtualEnvWrapper
..did the trick... where your powershell profile can find it ;)
来源:https://stackoverflow.com/questions/30655876/error-importing-virtualenvwrapper-to-the-powershell